#include "../server.h"

SVC_FUNC(HELLO)
{/*{{{*/
#if 0
    MYSQLC db=cnfg_info._db_.db[worker_idx];
    char sql[200];
    DBC_RSET rset;

    char para_desc[50];
    PARA para;
    char *rtn;
    char uuid[NAME_SIZE+1];
    char loginname[NAME_SIZE+1];
    char nickname[NAME_SIZE+1];
    int login_times;
    int res;

    sprintf(para_desc, "uuid(string:1-%d)", NAME_SIZE);
    res=para_load(request, para_desc, &para);
    if(res)
    {
        if(res > 0)
            errlog("%s: request(%.20s) no.%d para invalid",
                    __func__, request, res);
        else
            errlog("%s: para_load request(%.20s) fail, res:%d",
                    __func__, request, res);
        rtn=ERR_PARA;
        goto GO_OUT;
    }
    para_copy_by_name(para, "uuid", uuid);
    para_free(para);

    sprintf(sql,
            "select loginname,nickname,login_times from memb_info "
            "where uuid='%s'",
            uuid);
    res=mysqlc_query_ex(db, sql, 1, &rset);
    if(res != MY_OK && res != MY_NO_DATA_FOUND)
    {
        errlog("%s: mysqlc_query fail, res:%d",
                __func__, res);
        rtn=ERR_DB;
    }
    if(res == MY_NO_DATA_FOUND)
    {
        errlog("%s: mysqlc_query %s not found",
                __func__, uuid);
        para_put_item(respond, ERR_OK);
    }
    else
    {
        dbc_col_export_char(&rset, 0, 0, uuid);
        dbc_col_export_char(&rset, 0, 1, loginname); 
        dbc_col_export_char(&rset, 0, 2, nickname); 
        login_times=dbc_col_export_int(&rset, 0, 3); 
        dbc_query_free(&rset);
        para_put_item(respond, ERR_OK);
        para_put_item(respond, uuid);
        para_put_item(respond, loginname);
        para_put_item(respond, nickname);
        para_put_item_int(respond, login_times);
    }
    rtn=ERR_OK;

GO_OUT:
    para_insert_item(respond, rtn);
    return(atoi(rtn));
#endif

#if 0
    ORAPROC db=cnfg_info._db_.db[worker_idx];
    char sql[200];
    DBC_BIND bind;
    DBC_RSET rset;

    char para_desc[50];
    PARA para;
    char *rtn;
    char uuid[NAME_SIZE+1];
    char loginname[NAME_SIZE+1];
    char nickname[NAME_SIZE+1];
    int login_times;
    int res;

    sprintf(para_desc, "uuid(string:1-%d)", NAME_SIZE);
    if((res=para_load(request, para_desc, &para)))
    {
        if(res > 0)
            errlog("%s: request(%.20s) no.%d para invalid",
                    __func__, request, res);
        else
            errlog("%s: para_load request(%.20s) fail, res:%d",
                    __func__, request, res);
        rtn=ERR_PARA;
        goto GO_OUT;
    }
    para_copy_by_name(para, "uuid", uuid);
    para_free(para);

    sprintf(sql,
            "select loginname,nickname,login_times from memb_info "
            "where uuid=:0");
    dbc_bind_varchar(&bind, 0, uuid, NAME_SIZE);
    res=oraproc_query_ex(db, sql, &bind, 1, 1, &rset);
    if(res != ORA_OK && res != ORA_NO_DATA_FOUND)
    {
        errlog("%s: oraproc_query fail, res:%d",
                __func__, res);
        RETURN_ERR_DB;
    }
    if(res == ORA_NO_DATA_FOUND)
    {
        errlog("%s: oraproc_query %s not found",
                __func__, uuid);
        para_put_item(respond, ERR_OK);
    }
    else
    {
        dbc_col_export_char(&rset, 0, 0, uuid);
        dbc_col_export_char(&rset, 0, 1, loginname); 
        dbc_col_export_char(&rset, 0, 2, nickname); 
        login_times=dbc_col_export_int(&rset, 0, 3); 
        dbc_query_free(&rset);
        para_put_item(respond, ERR_OK);
        para_put_item(respond, uuid);
        para_put_item(respond, loginname);
        para_put_item(respond, nickname);
        para_put_item_int(respond, login_times);
    }
    rtn=ERR_OK;

GO_OUT:
    para_insert_item(respond, rtn);
    return(atoi(rtn));
#endif

    para_put_item(respond, ERR_OK);
    para_put_item_int(respond, strlen(request));
    return(atoi(ERR_OK));
}/*}}}*/
